package exam.business.service;

import java.util.List;

import exam.common.constant.ResultPort;
import exam.common.key.KeyQuestion;
import exam.common.key.KeySubQuestion;
import exam.common.util.ConvertUtils;
import exam.model.dao.TQuestionDAO;
import exam.model.entity.TQuestionEntity;
import exam.system.business.AbstractService;
import exam.system.business.BusinessServiceInfo;
/**
 * <p>QuestionGetListFromSubService</p>
 * <br>
 * <p>Lay danh sach cau hoi thuoc chu de cau hoi</p> 
 *
 * @author Phong
 * @version (create: 21/5/2012)
 */
public class QuestionGetListFromSubService extends AbstractService {
	// tQuestionDAO
	private TQuestionDAO tQuestionDAO = new TQuestionDAO();
	@Override
	public String executeService(BusinessServiceInfo serviceInfo)
			throws Exception {
		// lay subQuestId tu serviceInfo
		String subQuestId = serviceInfo.getString(KeySubQuestion.SUB_QUEST_ID);
		// goi method lay danh sach cau hoi thuoc chu de cau hoi subQuestId
		List<TQuestionEntity> tQuestionEntityList = tQuestionDAO
				.selectBySubQuestion(ConvertUtils.convertStringToLong(subQuestId));
		// put tQuestionEntityList vao serviceInfo
		serviceInfo.put(KeyQuestion.T_QUESTION_ENTITY_LIST, tQuestionEntityList);
		return ResultPort.SUCCESS;
	}

}
